home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / superqix.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  10KB  |  308 lines

  1. /***************************************************************************
  2.  
  3. Super QIX memory map (preliminary)
  4.  
  5. driver by Mirko Buffoni
  6.  
  7. CPU:
  8. 0000-7fff ROM
  9. 8000-bfff BANK 0-1-2-3    (All banks except 2 contain code)
  10.  
  11. Notes:
  12. - the original doesn't work due to protection. There is an unknown ROM: code
  13.   for a mcu?
  14.  
  15. ***************************************************************************/
  16.  
  17. #include "driver.h"
  18. #include "vidhrdw/generic.h"
  19.  
  20.  
  21.  
  22. int superqix_vh_start(void);
  23. void superqix_vh_stop(void);
  24. READ_HANDLER( superqix_bitmapram_r );
  25. WRITE_HANDLER( superqix_bitmapram_w );
  26. READ_HANDLER( superqix_bitmapram2_r );
  27. WRITE_HANDLER( superqix_bitmapram2_w );
  28. WRITE_HANDLER( superqix_0410_w );
  29. void superqix_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  30.  
  31.  
  32.  
  33. static struct MemoryReadAddress readmem[] =
  34. {
  35.     { 0x0000, 0x7fff, MRA_ROM },
  36.     { 0x8000, 0xbfff, MRA_BANK1 },
  37.     { 0xe000, 0xffff, MRA_RAM },
  38.     { -1 }    /* end of table */
  39. };
  40.  
  41. static struct MemoryWriteAddress writemem[] =
  42. {
  43.     { 0x0000, 0xbfff, MWA_ROM },
  44.     { 0xe000, 0xe0ff, MWA_RAM, &spriteram, &spriteram_size },
  45.     { 0xe100, 0xe7ff, MWA_RAM },
  46.     { 0xe800, 0xebff, videoram_w, &videoram, &videoram_size },
  47.     { 0xec00, 0xefff, colorram_w, &colorram },
  48.     { 0xf000, 0xffff, MWA_RAM },
  49.     { -1 }    /* end of table */
  50. };
  51.  
  52. static struct IOReadPort readport[] =
  53. {
  54.     { 0x0000, 0x00ff, paletteram_r },
  55.     { 0x0401, 0x0401, AY8910_read_port_0_r },
  56.     { 0x0405, 0x0405, AY8910_read_port_1_r },
  57.     { 0x0418, 0x0418, input_port_4_r },
  58.     { 0x0800, 0x77ff, superqix_bitmapram_r },
  59.     { 0x8800, 0xf7ff, superqix_bitmapram2_r },
  60.     { -1 }    /* end of table */
  61. };
  62.  
  63. static struct IOWritePort writeport[] =
  64. {
  65.     { 0x0000, 0x00ff, paletteram_BBGGRRII_w },
  66.     { 0x0402, 0x0402, AY8910_write_port_0_w },
  67.     { 0x0403, 0x0403, AY8910_control_port_0_w },
  68.     { 0x0406, 0x0406, AY8910_write_port_1_w },
  69.     { 0x0407, 0x0407, AY8910_control_port_1_w },
  70.     { 0x0410, 0x0410, superqix_0410_w },    /* ROM bank, NMI enable, tile bank */
  71.     { 0x0800, 0x77ff, superqix_bitmapram_w },
  72.     { 0x8800, 0xf7ff, superqix_bitmapram2_w },
  73.     { -1 }    /* end of table */
  74. };
  75.  
  76.  
  77.  
  78. INPUT_PORTS_START( superqix )
  79.     PORT_START    /* IN0 */
  80.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
  81.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
  82.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
  83.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  84.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  85.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  86.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_VBLANK )    /* ??? */
  87.     PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
  88.  
  89.     PORT_START    /* IN1 */
  90.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_COCKTAIL )
  91.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_COCKTAIL )
  92.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_COCKTAIL )
  93.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  94.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  95.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  96.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  97.     PORT_BITX(    0x80, 0x00, IPT_DIPSWITCH_NAME, "Freeze???", IP_KEY_NONE, IP_JOY_NONE )
  98.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  99.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  100.  
  101.     PORT_START    /* DSW1 */
  102.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_B ) )
  103.     PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
  104.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  105.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ))
  106.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  107.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_A ) )
  108.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  109.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  110.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ))
  111.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
  112.     PORT_DIPNAME( 0x10, 0x00, "Allow Continue" )
  113.     PORT_DIPSETTING(    0x10, DEF_STR( No ) )
  114.     PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
  115.     PORT_DIPNAME( 0x20, 0x20, "Freeze" )
  116.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  117.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  118.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )
  119.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  120.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  121.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
  122.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  123.     PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
  124.  
  125.     PORT_START    /* DSW2 */
  126.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
  127.     PORT_DIPSETTING(    0x02, "Easy" )
  128.     PORT_DIPSETTING(    0x03, "Normal" )
  129.     PORT_DIPSETTING(    0x01, "Hard" )
  130.     PORT_DIPSETTING(    0x00, "Hardest" )
  131.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
  132.     PORT_DIPSETTING(    0x08, "20000 50000" )
  133.     PORT_DIPSETTING(    0x0c, "30000 100000" )
  134.     PORT_DIPSETTING(    0x04, "50000 100000" )
  135.     PORT_DIPSETTING(    0x00, "None" )
  136.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
  137.     PORT_DIPSETTING(    0x20, "2" )
  138.     PORT_DIPSETTING(    0x30, "3" )
  139.     PORT_DIPSETTING(    0x10, "4" )
  140.     PORT_DIPSETTING(    0x00, "5" )
  141.     PORT_DIPNAME( 0xc0, 0xc0, "Fill Area" )
  142.     PORT_DIPSETTING(    0x80, "70%" )
  143.     PORT_DIPSETTING(    0xc0, "75%" )
  144.     PORT_DIPSETTING(    0x40, "80%" )
  145.     PORT_DIPSETTING(    0x00, "85%" )
  146.  
  147.     PORT_START    /* IN2 */
  148.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  149.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  150.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
  151.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
  152.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
  153.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  154.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  155.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  156. INPUT_PORTS_END
  157.  
  158.  
  159.  
  160. static struct GfxLayout charlayout =
  161. {
  162.     8,8,    /* 8*8 characters */
  163.     1024,    /* 1024 characters */
  164.     4,      /* 4 bits per pixel */
  165.     { 0, 1, 2, 3 }, /* the bitplanes are packed in one nibble */
  166.     { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
  167.     { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
  168.     32*8   /* every char takes 32 consecutive bytes */
  169. };
  170.  
  171. static struct GfxLayout spritelayout =
  172. {
  173.     16,16,    /* 16*16 sprites */
  174.     512,    /* 512 sprites */
  175.     4,      /* 4 bits per pixel */
  176.     { 0, 1, 2, 3 }, /* the bitplanes are packed in one nibble */
  177.     { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
  178.             32*8+0*4, 32*8+1*4, 32*8+2*4, 32*8+3*4, 32*8+4*4, 32*8+5*4, 32*8+6*4, 32*8+7*4 },
  179.     { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
  180.             16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 },
  181.     128*8   /* every sprites takes 128 consecutive bytes */
  182. };
  183.  
  184. static struct GfxDecodeInfo gfxdecodeinfo[] =
  185. {
  186.     { REGION_GFX1, 0x00000, &charlayout,   0, 16 },    /* Chars */
  187.     { REGION_GFX2, 0x00000, &charlayout,   0, 16 },    /* Background tiles */
  188.     { REGION_GFX2, 0x08000, &charlayout,   0, 16 },
  189.     { REGION_GFX2, 0x10000, &charlayout,   0, 16 },
  190.     { REGION_GFX2, 0x18000, &charlayout,   0, 16 },
  191.     { REGION_GFX3, 0x00000, &spritelayout, 0, 16 },    /* Sprites */
  192.     { -1 } /* end of array */
  193. };
  194.  
  195.  
  196.  
  197. static struct AY8910interface ay8910_interface =
  198. {
  199.     2,    /* 2 chips */
  200.     1500000,    /* 1.5 MHz??? */
  201.     { 25, 25 },
  202.     { input_port_0_r, input_port_3_r },        /* port Aread */
  203.     { input_port_1_r, input_port_2_r },        /* port Bread */
  204.     { 0 },    /* port Awrite */
  205.     { 0 }    /* port Bwrite */
  206. };
  207.  
  208. int sqix_interrupt(void)
  209. {
  210.     static int loop=0;
  211.  
  212.     loop++;
  213.  
  214.     if(loop>2) {
  215.         if(loop==6) loop=0;
  216.         return nmi_interrupt();
  217.     }
  218.     else
  219.         return 0;
  220. }
  221.  
  222. static struct MachineDriver machine_driver_superqix =
  223. {
  224.     /* basic machine hardware */
  225.     {
  226.         {
  227.             CPU_Z80 | CPU_16BIT_PORT,
  228. //            10000000,    /* 10 Mhz ? */
  229.             6000000,    /* 6 Mhz ? */
  230.             readmem,writemem,readport,writeport,
  231. //            nmi_interrupt,3    /* ??? */
  232.             sqix_interrupt,6    /* ??? */
  233.         }
  234.     },
  235.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  236.     1,    /* single CPU, no need for interleaving */
  237.     0,
  238.  
  239.     /* video hardware */
  240.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  241.     gfxdecodeinfo,
  242.     256, 256,
  243.     0,
  244.  
  245.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,// | VIDEO_SUPPORTS_DIRTY,
  246.     0,
  247.     superqix_vh_start,
  248.     superqix_vh_stop,
  249.     superqix_vh_screenrefresh,
  250.  
  251.     /* sound hardware */
  252.     0,0,0,0,
  253.     {
  254.         {
  255.             SOUND_AY8910,
  256.             &ay8910_interface
  257.         }
  258.     }
  259. };
  260.  
  261.  
  262.  
  263. /***************************************************************************
  264.  
  265.   Game driver(s)
  266.  
  267. ***************************************************************************/
  268.  
  269. ROM_START( superqix )
  270.     ROM_REGION( 0x20000, REGION_CPU1 )    /* 64k for code */
  271.     ROM_LOAD( "sq01.97",      0x00000, 0x08000, 0x0888b7de )
  272.     ROM_LOAD( "sq02.96",      0x10000, 0x10000, 0x9c23cb64 )
  273.  
  274.     ROM_REGION( 0x08000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  275.     ROM_LOAD( "sq04.2",       0x00000, 0x08000, 0xf815ef45 )
  276.  
  277.     ROM_REGION( 0x20000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  278.     ROM_LOAD( "sq03.3",       0x00000, 0x10000, 0x6e8b6a67 )
  279.     ROM_LOAD( "sq06.14",      0x10000, 0x10000, 0x38154517 )
  280.  
  281.     ROM_REGION( 0x10000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  282.     ROM_LOAD( "sq05.1",       0x00000, 0x10000, 0xdf326540 )
  283.  
  284.     ROM_REGION( 0x1000, REGION_USER1 )    /* Unknown (protection related?) */
  285.     ROM_LOAD( "sq07.108",     0x00000, 0x1000, 0x071a598c )
  286. ROM_END
  287.  
  288. ROM_START( sqixbl )
  289.     ROM_REGION( 0x20000, REGION_CPU1 )    /* 64k for code */
  290.     ROM_LOAD( "cpu.2",        0x00000, 0x08000, 0x682e28e3 )
  291.     ROM_LOAD( "sq02.96",      0x10000, 0x10000, 0x9c23cb64 )
  292.  
  293.     ROM_REGION( 0x08000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  294.     ROM_LOAD( "sq04.2",       0x00000, 0x08000, 0xf815ef45 )
  295.  
  296.     ROM_REGION( 0x20000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  297.     ROM_LOAD( "sq03.3",       0x00000, 0x10000, 0x6e8b6a67 )
  298.     ROM_LOAD( "sq06.14",      0x10000, 0x10000, 0x38154517 )
  299.  
  300.     ROM_REGION( 0x10000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  301.     ROM_LOAD( "sq05.1",       0x00000, 0x10000, 0xdf326540 )
  302. ROM_END
  303.  
  304.  
  305.  
  306. GAMEX( 1987, superqix, 0,        superqix, superqix, 0, ROT90, "Taito", "Super Qix", GAME_NOT_WORKING | GAME_NO_COCKTAIL )
  307. GAMEX( 1987, sqixbl,   superqix, superqix, superqix, 0, ROT90, "bootleg", "Super Qix (bootleg)", GAME_NO_COCKTAIL )
  308.